package fr.axones.pocketagile.services.remote
{	
	import flash.net.URLRequestMethod;
	
	import fr.axones.pocketagile.services.remote.util.ResultHandler;
	import fr.axones.pocketagile.vo.ProjectUserVO;
	import fr.axones.pocketagile.vo.ProjectVO;
	import fr.axones.pocketagile.vo.UserVO;
	
	import mx.rpc.AsyncToken;
	
	import org.spicefactory.lib.reflect.types.Void;

	public class ProjectUserService
	{
		public function ProjectUserService()
		{
		}
		
		/**
		 * Add the project user
		 */
		public function addProjectUser(pu:ProjectUserVO):AsyncToken
		{
			var result:ResultHandler = new ResultHandler();
			
			result.doPost("http://axplanningpoker.appspot.com/rest/projectuser",JSON.stringify(pu));
			
			return result.token;
		}
		
		/**
		 * Delete the project user
		 */
		public function deleteProjectUser(projectId:Number, userId:Number):AsyncToken
		{
			var result:ResultHandler = new ResultHandler();
			
			result.doDelete("http://axplanningpoker.appspot.com/rest/projectuser/"+projectId+"/"+userId);
			
			return result.token;
		}
		
		/**
		 * Update the project user
		 */
		public function updateProjectUser(pu:ProjectUserVO):AsyncToken
		{
			var result:ResultHandler = new ResultHandler();
			
			result.doPut("http://axplanningpoker.appspot.com/rest/projectuser",JSON.stringify(pu));
			
			return result.token;
		}
	}
}